// Copyright (c) 2009 http://grommet.codeplex.com
// This source is subject to the Microsoft Public License.
// See http://www.opensource.org/licenses/ms-pl.html
// All other rights reserved.

using System;
using Microsoft.SPOT;

namespace System.Net
{
    public enum WebExceptionStatus
    {
        Success,
        NameResolutionFailure,
        ConnectFailure,
        ReceiveFailure,
        SendFailure,
        PipelineFailure,
        RequestCanceled,
        ProtocolError,
        ConnectionClosed,
        TrustFailure,
        SecureChannelFailure,
        ServerProtocolViolation,
        KeepAliveFailure,
        Pending,
        Timeout,
        ProxyNameResolutionFailure
    }

    public class WebException : InvalidOperationException
    {
        public WebExceptionStatus Status { get; set; }
        public WebResponse Response { get; set; }

        public WebException(WebExceptionStatus status, WebResponse response)
        {
            this.Status = status;
            this.Response = response;
        }

        public WebException(WebExceptionStatus status, WebResponse response, string message)
            : base(message)
        {
            this.Status = status;
            this.Response = response;
        }

        public WebException(WebExceptionStatus status, WebResponse response, string message, Exception innerException)
            : base(message, innerException)
        {
            this.Status = status;
            this.Response = response;
        }
    }
}
